<template>
  <div>
    <div>
      用户名:<input type="text" v-model="user.username" /> 密码:<input
        type="text"
        v-model="user.password"
      />
    </div>
    <button @click="login">登录</button>
  </div>
</template>

<script>
import { userlogin } from "@/apis/user.js";
export default {
  data() {
    return {
      user: {
        username: "",
        password: "",
      },
    };
  },
  methods: {
    login() {
      userlogin(this.user)
        .then(function (res) {
          console.log(res);
        })
        .catch(function (err) {
          console.log(err);
        });
    },
  },
};
</script>

<style>
</style>